package com.oocl.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;

import com.oocl.pojo.Books;
import com.oocl.service.BookManager;
import com.oocl.service.impl.BookManagerImpl;
import com.oocl.util.InstanceFactory;

public class StoreServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	Logger logger = Logger.getLogger(StoreServlet.class);
	private BookManager manager;
 
    public StoreServlet() {
        super();
        manager = InstanceFactory.newInstance(BookManagerImpl.class);
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		List<Books> books = manager.findAll();
		request.setAttribute("books", books);
		request.getRequestDispatcher("../WEB-INF/store.jsp").forward(request, response);
	}

}
